// dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"

BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
					 )
{
	// We sure as hell don't want or need DLL_THREAD_ATTACH calls
	DisableThreadLibraryCalls(hModule);

	// Only handle process attachment
	switch (ul_reason_for_call)
	{
		case DLL_PROCESS_ATTACH:
		{
			// All patches from here on out courtesy of Vice Players
			// <Client/game/CGame.cpp>
			//
			// Disable the inter-island load screens
			Unprotect(0x40DFE4, 0xA);
			memset((PVOID)0x40DFE4, 0x90, 0xA);
			
			Unprotect(0x40DFF4, 0x38);
			memset((PVOID)0x40DFF4, 0x90, 0x38);

			// Disable menu when returning from Alt+Tab
			Unprotect(0x4A4FFC, 7);
			memset((PVOID)0x4A4FFC, 0x90, 7);

			// Disable plane traffic. We don't need it.
			Unprotect(0x4A4515, 5);
			memset((PVOID)0x4A4515, 0x90, 5);

			#ifdef _LITERALLY_HITLER
				// Disable taxi cash
				Unprotect(0x5B8AB6, 1);
				*(BYTE *)0x5B8AB6 = 0;

				// Disable obtaining golf clubs when entering caddies
				Unprotect(0x5B89C0, 1);
				*(BYTE *)0x5B89C0 = 0xEB;

				// Disable obtaining shotguns from police cars
				Unprotect(0x5B895F, 1);
				*(BYTE *)0x5B895F = 0xEB;

				// Disable obtaining health when entering ambulance
				Unprotect(0x5B8A4B, 2);
				memset((PVOID)0x5B8A4B, 0x90, 2);

				// Disable obtaining armour when entering enforcer
				Unprotect(0x5B8A5A, 6);
				memset((PVOID)0x5B8A4B, 0x90, 6);
			#endif

			break;
		}
	}

	// Our work here is done
	return TRUE;
}

